package com.heyqing.topic.IsPowerOfThree_0326;

/**
 * ClassName:IsPowerOfThree
 * Package:com.heyqing.topic.IsPowerOfThree_0326
 * Description:
 *
 * @Date:2024/9/26
 * @Author:Heyqing
 */
public class IsPowerOfThree {
    public boolean isPowerOfThree(int n) {
        if (n <= 0) return false;
        return n - Math.pow(3, Math.ceil(Math.log(n) / Math.log(3))) == 0;
    }
}
